package com.qdxwx.data.service.account;

import com.qdxwx.common.exception.AccountException;
import com.qdxwx.common.page.PageRequest;
import com.qdxwx.models.account.UserAccount;
import com.qdxwx.models.account.UserAccountDTO;
import com.qdxwx.models.enums.AccountBizType;
import com.qdxwx.models.enums.AccountHistoryType;
import com.qdxwx.models.enums.AccountType;
import com.qdxwx.models.manager.Manager;

import java.util.List;

/**
 * UserAccount接口
 * Qdx NetSchool Platform
 * @author qdxwx
 * @updateTime 2022/5/25
 * @description
 */
public interface UserAccountService {

    /**
     * 添加UserAccount
     */
    void insert(UserAccount userAccount);

    /**
     * 根据id获取单个UserAccount对象
     */

    UserAccount getByUserId(long userId);
    /**
     * 根据用户id获得详情
     */
    UserAccountDTO getDTOByUserId(long userId);
    /**
     * 账户扣款，消费，出账
     */
    UserAccount deduct(UserAccount account, int amount, AccountHistoryType accountHistoryType, int orderId,
                       String description, boolean isDisplay, AccountBizType accountBizType) throws AccountException;

    /**
     * 账户入账,充值
     */
    UserAccount income(UserAccount account, int amount, AccountType accountType, AccountHistoryType accountHistoryType, int orderId,
                       String description, boolean isDisplay, AccountBizType accountBizType) throws AccountException;


    int update(UserAccount userAccount);

    List<UserAccountDTO> getList(UserAccountDTO account, PageRequest page);

    long count(UserAccountDTO account);

    void deleteByIds(String[] idsArr);

    int delete(long userId);

    void addUserAccountOpt(long userId, Manager manager, int amount, String type, String outNo);

    int updateCombine(long userId, UserAccount userAccount);
}